<template>
  <div class="app-box">
    <h1>单页应用</h1>
    <!-- 路由链接 -->
    <router-link to="/home">首页</router-link>
    <router-link to="/about">关于</router-link>
    <router-link to="/my">我的</router-link>
    <hr />
    <!-- 路由视图 - 添加转场动画 -->
    <transition name="fade" mode="out-in">
      <router-view></router-view>
    </transition>
  </div>
</template>

<script setup>
</script>

<style scoped>
.app-box {
  text-align: center;
  font-size: 20px;
}
.app-box a {
  padding: 20px;
  color: black;
  text-decoration: none;
  font-weight: bold;
}
.app-box a.router-link-active {
  color: blueviolet;
}

/* 添加转场动画样式 */
.fade-enter-active,
.fade-leave-active {
  transition: opacity 1s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}
</style>